Fix: Detect workspace as default when it matches cwd (#311)#338
Fix: Detect workspace as default when it matches cwd (#311)#338beyandbey wants to merge 4 commits intoComfy-Org:mainfrom
Conversation
- detect WorkspaceType.DEFAULT when run from default directory - use --here to detect as WorkspaceType.CURRENT_DIR instead
Codecov Report❌ Patch coverage is
@@ Coverage Diff @@
## main #338 +/- ##
==========================================
- Coverage 52.18% 52.15% -0.04%
==========================================
Files 32 32
Lines 3516 3520 +4
==========================================
+ Hits 1835 1836 +1
- Misses 1681 1684 +3
🚀 New features to boost your workflow:
|
comfy_cli/workspace_manager.py
Outdated
| # Check for user-set default workspace | ||
| default_workspace = self.config_manager.get(constants.CONFIG_KEY_DEFAULT_WORKSPACE) | ||
| w_type = WorkspaceType.CURRENT_DIR | ||
| if valid_default_workspace and default_workspace == current_directory: |
There was a problem hiding this comment.
Should it be like this?
if valid_default_workspace and default_workspace == comfy_repo.working_dir:
w_type = WorkspaceType.DEFAULT
If a user is in a subdirectory of ComfyUI (e.g., /home/user/ComfyUI/custom_nodes/MyNode):
- current_directory = /home/user/ComfyUI/custom_nodes/MyNode
- comfy_repo.working_dir = /home/user/ComfyUI
- default_workspace = /home/user/ComfyUI
The comparison default_workspace == current_directory would fail even though the user is inside their default workspace.
There was a problem hiding this comment.
Your're right, good point! Changing the comparison to default_workspace == comfy_repo.working_dir does recognize it properly
|
Hey @beyandbey, thanks for digging into this and putting up the fix! I went ahead and opened #374 with a similar approach - the main difference is using Appreciate you identifying the root cause, that made it easy to put together. |
Fixes #311
comfy launchused to detect Workspace.CURRENT_DIR when launched from within the directory marked as default.This lead to some unexpected behavior, i.e. not being able to apply default launch extras.
When working from within the default workspace, I'd assume the user wants to apply default settings as well. Hence following changes:
This makes working within the default workspace more convenient, whilst preserving the possibility to opt-out of default behavior.